﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Reconciliation.Data
{
    public partial class Bank
    {
        public static Domain.Bank MapDataToDomain(Data.Bank dataBank)
        {
            Domain.Bank domainBank = new Reconciliation.Domain.Bank();
            domainBank.BankCode = dataBank.BankCode ;
            domainBank.BankID = dataBank.BankID ;
            domainBank.BankName = dataBank.BankName ;
            domainBank.Contact_Email = dataBank.Contact_Email ;
            domainBank.ContactAreaCode = dataBank.ContactAreaCode ;
            domainBank.ContactFacsimile = dataBank.ContactFacsimile ;
            domainBank.ContactTelephone = dataBank.ContactTelephone ;
            if (dataBank.Location != null)
                domainBank.Location = Location.MapDataToDomain(dataBank.Location);
            return domainBank;
        }

        public static List<Domain.Bank> GetBankList()
        {
           List<Domain.Bank> bankList = new List<Reconciliation.Domain.Bank>();
            ReconciliationEntities recEnt = new ReconciliationEntities();
            bankList = (from b in recEnt.Bank
                       select new Domain.Bank
                       {
                           BankID = b.BankID,
                           BankCode = b.BankCode
                       }).ToList();
            return bankList;
        }
    }
}
